package vd

import (
	"math/big"
	"kumachan/standalone/ctn"
)


type Transformer struct {
	*Serializer
	*Deserializer
}

type Serializer struct {
	PrimitiveSerializer
	ContainerSerializer
	AlgebraicSerializer
}
type PrimitiveSerializer struct {
	WriteBool     func(Object) bool
	WriteFloat    func(Object) float64
	WriteComplex  func(Object) complex128
	WriteInteger  func(Object) *big.Int
	WriteString   func(Object) string
	WriteBinary   func(Object) ([] byte)
}
type ContainerSerializer struct {
	UnwrapOptional  func(Object) (Object, bool)
	IterateArray    func(Object, func(uint,Object)(error)) error
}
type AlgebraicSerializer struct {
	AccessEnum      func(TypeId, Object) (string,*Type,Object)
	IterateRecord   func(TypeId, Object, func(string,*Type,Object)(error)) error
}

type Deserializer struct {
	PrimitiveDeserializer
	ContainerDeserializer
	AlgebraicDeserializer
}
type PrimitiveDeserializer struct {
	ReadBool     func(bool) Object
	ReadFloat    func(float64) Object
	ReadComplex  func(complex128) Object
	ReadInteger  func(*big.Int) (Object, bool)
	ReadString   func(string) Object
	ReadBinary   func([] byte) Object
}
type ContainerDeserializer struct {
	Some         func(inner_obj Object, inner_t *Type) Object
	None         func(inner_t *Type) Object
	CreateArray  func(element_t *Type) Object
	AppendItem   func(array_ptr *Object, item Object)
}
type AlgebraicDeserializer struct {
	CheckSupport  func(TypeId, TypeKind) bool
	MakeEnum      func(TypeId, func(ctn.Map[string,*Type])(string,Object,error)) (Object,error)
	MakeRecord    func(TypeId, func(ctn.Map[string,*Type])(ctn.Map[string,Object],error)) (Object,error)
}


